package view.renderers;

import java.awt.Color;
import java.util.List;

import prefuse.action.assignment.DataColorAction;
import prefuse.visual.VisualItem;
import view.visualizations.XCVis;

/**
 * Let's us decide for ourselves how to color things and let's us "select" items.
 */
public class TeamColorAction extends DataColorAction {

	private List<String> selectedNames;
	private Color color;
	
	
//	public TeamColorAction(final String group, final String field, final XCVis vis, final Color c) {
//		this(group, field, vis);
//		color = c;
//	}	
	public TeamColorAction(final String group, String dataField, int dataType, final String field, final XCVis vis) {	
		super(group, dataField, dataType, field);
		selectedNames = vis.getSelectedNames();
//		System.out.println("selected size: " + selectedNames.size());
	}

	@Override
	public int getColor(final VisualItem item) {
		if (selectedNames.contains(item.get("Name"))) {
			return Color.blue.getRGB();
		}
//		if (color != null) {
//			return color.getRGB();
//		}
		if (super.getColor(item) == Color.blue.getRGB()) {
			return Color.green.getRGB();
		}
		return super.getColor(item);
	}

}
